<template>
  <div class="ranking">
    <div class="title">排行榜</div>
    <div class="more"><a href="/rankingmore">更多</a></div>
    <div class="rankingcontent">
        <div class="left">
            <div class="left-title">
                新歌排行
            </div>
            <div class="left-item" v-for="(item,index) of newranking" :key="item.id">
                <span>{{index+1}}</span> 
                <div class="img"><img :src="item.al.picUrl" alt=""></div>
                 <div class="left-name">{{item.al.name | handleString}}</div>
                 <div class="left-song">{{item.ar[0].name}}</div>
            </div>
            <div class="left-more"><a href="/rankingmore/newranking">更多></a></div>
        </div>
        <div class="right">
             <div class="left-title">
                热歌排行
            </div>
            <div class="right-item" v-for="(item,index) of hotranking" :key="item.id">
                <span>{{index+1}}</span> 
                <div class="img"><img :src="item.al.picUrl" alt=""></div>
                 <div class="right-name">{{item.al.name|handleString}}</div>
                 <div class="right-song">{{item.ar[0].name}}</div>
            </div>
            <div class="right-more"><a href="/rankingmore/hotranking">更多></a></div>
        </div>
    </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            newranking:[],
            hotranking:[]
        }
    },
    mounted() {
        this.$http("/playlist/detail?id=3779629").then(res=>{
            this.newranking = res.data.playlist.tracks.slice(0,3)
        })
        this.$http("/playlist/detail?id=3778678").then(res=>{
            // console.log(res);
            this.hotranking = res.data.playlist.tracks.slice(0,3)
        })
    },
};
</script>

<style scoped>
.ranking {
    width: 1200px;
    margin: 0 auto;
}
.title {
    width: 220px;
    text-align: center;
    margin: 0 auto;
    padding: 10px 0;
    border-radius: 18px;
    background-color: #abc4ff;
}
.more {
    text-align: right;
    margin-right: 30px;
}
.rankingcontent {
    margin-top: 30px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 50px;
}
.left {
    border-radius: 20px;
    width: 500px;
    background-color: #edf2fb;
}
.right {
    border-radius: 20px;
    width: 500px;
    background-color: #edf2fb;
}

.left-title {
    padding: 20px 0;
    margin-left: 40px;
}
.right-title {
    padding: 20px 0;
    margin-left: 40px;
}
.left-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    border-top: 1px solid #d7e3fc;
}
.right-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    border-top: 1px solid #d7e3fc;
}

.img img {
    margin-left: 40px;
    height: 60px;
    width: 60px;
}
.left-more {
     border-top: 1px solid #d7e3fc;
    padding: 20px 0;
    text-align: right;
}
.right-more {
     border-top: 1px solid #d7e3fc;
    padding: 20px 0;
    text-align: right;
}
.left-item  span{
    width: 50px;
    margin-left: 30px;
}
.right-item  span{
    width: 50px;
    margin-left: 30px;
}
.left-name {
    width: 80px;
    margin-left: 60px;
}
.right-name {
    width: 80px;
    margin-left: 60px;
}
.left-song {
    width: 80px;
    margin-right: 20px;
}
.right-song {
    width: 80px;
    margin-right: 20px;
}
</style>